package main

import "sort"

func singleNumber(nums []int) []int {
	sort.Ints(nums)
	val := nums[0]
	count := 0
	result := make([]int, 0)
	for _, v := range nums {
		if v == val {
			count++
		} else {
			if count < 2 {
				result = append(result, val)
				if len(result) == 2 {
					return result
				}
			}
			val = v
			count = 1
		}
	}
	if count < 2 {
		result = append(result, val)
	}
	return result
}

func main() {
	nums := []int{1, 2, 1, 3, 2, 5}
	result := singleNumber(nums)
	println(result)
}
